home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OctaMED Sound Studio 1
/
OctaMED SoundStudio V1.iso
/
docs
/
rexx
/
orgplayseq.omed
< prev
next >
Wrap
Text File
|
1996-06-18
|
3KB
|
117 lines
/* Organize Playing Sequence - Ed Wiles, 21st March 1995 */
/* NOTE: Ignores sections! (i.e. only works with one playing sequence) */
/* Also ignores line highlighting */
address OCTAMED_REXX
options results
'wi_request "Really organize the playing sequence? (Blocks may be deleted)" Organize|Cancel'
if result = 0 then exit
'ed_getnumblocks var numblocks'
if numblocks = 1 then do
'wi_showstring Song has only one block!'
exit
end
'op_update off'
'wi_close playingseq'
'wi_close blocklist'
'wi_close blockproperties'
block = 0
'wi_showstring Deleting blocks not in playing sequence...'
do until block >= result
'ed_isblockinseq block' block
if result = 0 then do
'ed_goto block' block
'ed_deleteblock'
end
block = block + 1
ed_getnumblocks
end
'ed_getnumplayseq var seqlen'
'wi_showstring Getting sequence blocks...'
do i = 1 to seqlen
'ed_getplayseqblock' i 'var oldseq.'i
end
newseq.0 = 0; 'ed_setplayseqblock 0 0'
newblock = 1; flag = -1;
'wi_showstring Organizing playing sequence...'
do seqpos = 1 to seqlen - 1
do i = 0 to seqpos - 1
if oldseq.i = oldseq.seqpos then do
flag = i
break
end
end
if flag >= 0 then
newseq.seqpos = newseq.flag
else do
newseq.seqpos = newblock
newblock = newblock + 1
end
'ed_setplayseqblock' seqpos newseq.seqpos; flag = -1
end
currblock = 0
'wi_showstring Swapping blocks...'
do seqpos = 0 to seqlen - 1
if newseq.seqpos < currblock then iterate
if oldseq.seqpos ~= newseq.seqpos then do
'ed_goto block' oldseq.seqpos
'ed_getnumtracks var oldtracks'
'ed_getblockname var oldname'
'rn_copy block'
'ed_goto block' newseq.seqpos
'ed_getnumtracks var newtracks'
if oldtracks > newtracks then 'ed_setblocktracks' oldtracks
'ed_getblockname var newname'
'rn_swap block'
if oldtracks < newtracks then do
'ed_setblocktracks' oldtracks
'ed_setblocktracks block' oldseq.seqpos newtracks
end
if compare(oldname, newname) ~= 0 then do
flag = 1
'ed_setblockname "'oldname'"'
end
'ed_goto block' oldseq.seqpos
'rn_paste block'
if flag = 1 then do
flag = 0
'ed_setblockname "'newname'"'
end
do i = seqpos + 1 to seqlen - 1
if oldseq.i = currblock then oldseq.i = oldseq.seqpos
end
end
currblock = currblock + 1
end
'ed_gotoblock first'
'ed_gotoplayseq first'
'op_update on'
'wi_showstring Playing sequence organized.'